asm
  ld sp,$FFFF
  end asm

#include "./library/smsrnd.bas"
#include "./library/pacmandelay.bas"
#include "./library/b4r3f0e1_charmapmegadon.zxi"
#include "./library/minivadersldirxor.bas"

dim eee as uinteger at $FC10
dim seed as uinteger at $FC12
dim ee0 as uinteger at $FC14
dim ee1 as uinteger at $FC16
dim ee2 as uinteger at $FC18
dim ee3 as uinteger at $FC1A
dim eex as uinteger at $FC1C
dim eey as uinteger at $FC1E

sub laserbaseputchar(txp1 as uinteger,typ1 as uinteger,tch1 as uinteger,tad1 as uinteger,txr1 as ubyte,txo1 as uinteger)
  dim txl1 as uinteger at $FC00
  dim tyl1 as uinteger at $FC02
  for txl1=0 to 7
    minivadersldirxor( $4000+((txl1+txo1)*128)+((31-typ1)*4)+(txp1*1024) , (tad1+(txl1*4)+(tch1*32)) ,4, txr1)
    next
  end sub


seed=23774


'--------rrrgggbb
out $80,%10010010
out $81,%11110000
out $8F,%10010011
out $98,%11010001
out $9F,%11111010

for eee=$80 to $9F
  seed=smsrnd(seed)
  out (eee band $FF),(seed band $FF)
  next

for ee1=0 to 31
  for ee0=0 to 31
    seed=smsrnd(seed)
    laserbaseputchar(ee0,ee1,0+(seed mod 16),@charmap01,$00,0)
    next:next

for ee1=0 to 7
  for ee0=0 to 15
    seed=smsrnd(seed)
    laserbaseputchar(ee0+15,ee1+15,ee1*16+ee0,@charmap01,$DD,0)
    laserbaseputchar(ee0+15,ee1+23,ee1*16+ee0,@charmap01,$22,0)
    next:next

eex=8:eey=8
eee=0
do

laserbaseputchar(1,1,48+(int(eee/100) mod 10),@charmap01,$EE,2)
laserbaseputchar(2,1,48+(int(eee/10) mod 10),@charmap01,$EE,2)
laserbaseputchar(3,1,48+(eee mod 10),@charmap01,$EE,2)


ee1=in($20) bxor $FF
laserbaseputchar(1,3,48+(int(ee1/100) mod 10),@charmap01,$BB,0)
laserbaseputchar(2,3,48+(int(ee1/10) mod 10),@charmap01,$BB,0)
laserbaseputchar(3,3,48+(ee1 mod 10),@charmap01,$BB,0)

ee1=in($21) bxor $FF
laserbaseputchar(1,4,48+(int(ee1/100) mod 10),@charmap01,$BB,0)
laserbaseputchar(2,4,48+(int(ee1/10) mod 10),@charmap01,$BB,0)
laserbaseputchar(3,4,48+(ee1 mod 10),@charmap01,$BB,0)

eex=eex+((ee1 band 1)/1)-((ee1 band 2)/2)
eey=eey+((ee1 band 4)/4)-((ee1 band 8)/8)
laserbaseputchar(eex mod 29,eey mod 34,eee band $7F,@charmap01,$77,0)




ee1=in($22) bxor $FF
laserbaseputchar(1,5,48+(int(ee1/100) mod 10),@charmap01,$BB,0)
laserbaseputchar(2,5,48+(int(ee1/10) mod 10),@charmap01,$BB,0)
laserbaseputchar(3,5,48+(ee1 mod 10),@charmap01,$BB,0)

ee1=in($23) bxor $FF
laserbaseputchar(1,6,48+(int(ee1/100) mod 10),@charmap01,$BB,0)
laserbaseputchar(2,6,48+(int(ee1/10) mod 10),@charmap01,$BB,0)
laserbaseputchar(3,6,48+(ee1 mod 10),@charmap01,$BB,0)






eee=eee+1
loop




do:loop

do

for eee=$80 to $9F
  seed=smsrnd(seed)
  out (eee band $FF),(seed band $FF)
  next

for ee1=0 to 31
  for ee0=0 to 31
    seed=smsrnd(seed)
    laserbaseputchar(ee0,ee1,0+(seed mod 16),@charmap01,$00,0)
    next:next

loop

do



for ee3=0 to 31
  for ee1=0 to 31
    seed=smsrnd(seed)
    for ee0=0 to 7
      for ee2=0 to 3
        poke $4000+(ee1*1024)+ee2+(ee0*128)+((ee3 bxor 31)*4),peek(@charmap01+(ee0*4)+ee2+  (32*  (seed mod 96)  ) )


        next:next
    pacmandelay(1000)
    next:next

loop

do:loop


for eee=$4000 to $BFFF
  seed=smsrnd(seed)
  poke eee,seed
  next



do:loop



'--------------------------------------
'$????
goto jmpgap01:
asm
org $C000
end asm
jmpgap01:
'$C000
'--------------------------------------


qqq1:
asm

defb $F0,$FF,$FF,$FF
defb $F0,$FF,$FF,$FF
defb $00,$F0,$00,$F0
defb $00,$F0,$00,$F0
defb $00,$F0,$00,$F0
defb $00,$F0,$FF,$FF
defb $00,$00,$FF,$0F
defb $00,$00,$00,$00


defb $11,$11,$11,$00
defb $11,$00,$10,$01
defb $11,$00,$10,$01
defb $11,$00,$10,$01
defb $11,$11,$11,$00
defb $11,$00,$00,$00
defb $11,$00,$00,$00
defb $00,$00,$00,$00

end asm





'- static ADDRESS_MAP_START( laserbas_memory, AS_PROGRAM, 8, laserbas_state )
'- AM_RANGE(0x0000, 0x3fff) AM_ROM
'- AM_RANGE(0x4000, 0xbfff) AM_READWRITE(vram_r, vram_w)
'- AM_RANGE(0xc000, 0xf7ff) AM_ROM
'- AM_RANGE(0xf800, 0xfbff) AM_READWRITE(protram_r, protram_w) AM_SHARE("protram") /* protection device */
'- AM_RANGE(0xfc00, 0xffff) AM_RAM




'
'sub putchar(txpos as uinteger,typos as uinteger,tch as uinteger, tadr as uinteger,txor as ubyte)
'  dim trt as uinteger at $A000
'  'for trt=0 to 7
'  '  poke $A200+(txpos band 31)+(trt*32)+((typos mod 28)*256),peek(tadr+(tch*8)+trt) bxor txor
'  '  next
'  'minivadersldir32b($A200+(txpos band 31)+(trt*32)+((typos mod 28)*256), tadr+(tch*8),8)
'  'minivadersfillramxor32b($A200+(txpos band 31)+(trt*32)+((typos mod 28)*256),txor,8)
'
'  minivadersldirxor32b($A200+(txpos band 31)+(trt*32)+((typos mod 28)*256), tadr+(tch*8),8,txor)
'  end sub
'
'sub writetext(txpos2 as uinteger,typos2 as uinteger,ttxt as uinteger, tleng as uinteger,tadr2 as uinteger, txor2 as uinteger)
'  dim trt2 as uinteger at $A002
'  for trt2=0 to tleng-1
'    putchar(txpos2+trt2,typos2,peek(ttxt+trt2),tadr2,txor2)
'    next
'  end sub
'
'for eey=0 to 27
'  for eex=0 to 31
'    seed=smsrnd(seed)
'    putchar(eex,eey,96+(seed mod 9),@charmap01-253,$FF)
'    next:next
'
'for eey=0 to 7
'  for eex=0 to 15
'    putchar(eex+15,eey+11,eex+(eey*16),@charmap01-253,$FF)
'    putchar(eex+15,eey+19,eex+(eey*16),@charmap01-253,$00)
'    next:next
'
'writetext(15,9,@text01,14,@charmap01-253,$FF)
'
'exps=16
'eee=0
'
'do
'  ejst=peek($E008) bxor 255
'  putchar(3,9,48+ (ejst mod 10)  ,@charmap01-253,$FF)
'  putchar(2,9,48+ ( int(ejst/10) mod 10)  ,@charmap01-253,$FF)
'  putchar(1,9,48+ ( int(ejst/100) mod 10)  ,@charmap01-253,$FF)
'  eee=eee+1
'  if (ejst band 1)<>0 then:exps=exps-1:end if
'  if (ejst band 2)<>0 then:exps=exps+1:end if
'  eqq=96+(eee mod 9)
'  if (ejst band 4)<>0 then:eqq=96+4:end if
'  putchar(exps,7,eqq,@charmap01-253,$FF)
'  pacmandelay(2000)
'  loop
'
'
'
'seed=0
'
'delay=100
'
''for eey2=0 to 27
''  for eex=0 to 31
''    for eey=0 to 7
''      for eee=1 to delay:next
''      seed=smsrnd(seed)
''      poke $A200+eex+(eey*32)+(eey2*256),seed
''      next:next:next
'
'
'do
'  seed=smsrnd(seed):eey2=seed mod 28
'  seed=smsrnd(seed):eex=seed band 31
'  for eey=0 to 7
'    poke $A200+eex+(eey*32)+(eey2*256),$00
'    next
'  seed=smsrnd(seed):eey2=seed mod 28
'  seed=smsrnd(seed):eex=seed band 31
'  for eey=0 to 7
'    poke $A200+eex+(eey*32)+(eey2*256),$FF
'    next
'  seed=smsrnd(seed):eey2=seed mod 28
'  seed=smsrnd(seed):eex=seed band 31
'  for eey=0 to 7
'    seed=smsrnd(seed)
'    poke $A200+eex+(eey*32)+(eey2*256),seed
'    next
'  loop
'
'
'delay=1000
'do
'  for eee=$A200 to $BDFF
'    seed=smsrnd(seed)
'    poke eee,seed
'    next
'  for eee=1 to delay:next
'  for eee=$A200 to $BDFF
'    poke eee,0
'    next
'  for eee=1 to delay:next
'  loop
'
'
'do
'  loop
'
'text01:
'asm
'  defb "HELLO WORLD!!!!!"
'  end asm
'
'
'
'
'
''-------------------------------------------------------------------------------
'
'
'
